﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using OpenCL.Nemerle;
using GASS.OpenCL;

namespace Samples.CLInfo
{
    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();

            treeView1.SuspendLayout();
            try {
                foreach(var platform in Platform.GetPlatforms()) {
                    var platform_node = treeView1.Nodes.Add(platform.Name);
                    platform_node.Tag = platform;
                    foreach(var device in platform.GetDevices(CLDeviceType.All)) {
                        var device_node = platform_node.Nodes.Add(device.Name);
                        device_node.Tag = device;
                    }
                }
                treeView1.ExpandAll();
            } finally {
                treeView1.ResumeLayout();
            }
        }
        
        void TreeView1AfterSelect(object sender, TreeViewEventArgs e)
        {
            if(null != e.Node && null != e.Node.Tag) {
                Text = "OpenCL Info - " + e.Node.Tag;
                propertyGrid1.SelectedObject = e.Node.Tag;
            }
        }
    }
}
